package commonmark;

import org.commonmark.node.Node;
import org.commonmark.parser.Parser;
import org.commonmark.renderer.html.HtmlRenderer;
import org.junit.Test;

/**
 * @Author 56465
 * @Create 2024/7/29 13:37
 */
public class Demo {
    @Test
    /**
     * 常规的使用
     */
    public void test() {
        String markdown = """
                ### Hello World
                                
                This is a test of the emergency broadcast system.
                                
                * Item 1
                * Item 2
                * Item 3
                                
                1. Item 1"
                
                ```java
                String q = "";
                ```
                
                test
                
                `String`
                
                - jjj
                
                [] xxx
                
                """;
        HtmlRenderer renderer = HtmlRenderer.builder().build();
        Parser parser = Parser.builder().build();
        Node document = parser.parse(markdown);
        // 将 markdown 转换为 HTML
        String result = renderer.render(document);
        System.out.println("result = " + result);
    }

    @Test
    public void test2() {
        System.out.println("Hello World");
    }

}
